package com.admin;

import com.admin.action.book_type_action.BookTypeAddAction;
import com.admin.action.bookaction.*;


import com.admin.action.boraction.*;
import com.admin.action.lend_book_action.LendBookAction;
import com.admin.action.library_page_action.*;
import com.admin.action.login_verify_action.AdminRegisterAction;
import com.admin.action.login_verify_action.LoginVerifyAction;
import com.admin.action.login_verify_action.ValueDateAdminAction;
import com.admin.action.query_book_Info.QueryAllBookAction;
import com.admin.action.query_book_Info.QueryAllBookInfoAction;
import com.admin.action.return_book_action.ReturnBookAction;


public class ActionFactory {
    public static  final String ADD="add";//图书类型的增加

    public static final String  GET_BOR_INFO ="getBorInfo";   //查询借阅者信息
//    adminMainMsg
    public static final String ADMIN_REGISTER="adminRegister";

    public static final String LOGIN_VERIFY ="loginVerify"; //登录传入用户名和密码

    public static final String BOR_RECHARGE = "borRecharge"; //管理员对借阅者充钱

    public static final String UPDATE_CANCEL = "updateCancel";  //修改用户注销信息

    public static final String GET_BORROW_INFO = "getBorrowInfo";  //获得借书信息



    public static final String LIST_BOOK = "books-list";//书籍的显示
    public static final String BOOK_ALTER = "book-alter";//书籍的修改
    public static final String BOOK_DEL= "book-del";//书籍的下架
    public static final String USER_MSG= "user-msg";//留言
    public static final String BOOKS_ADD= "books-add";//书籍添加
    public static final String BOOKS_TOP= "books-top";//书籍排行
    public static final String ALL_BOR_INFO = "allBorInfo";
    public static final String LEND_BOOK = "lendBook";//借阅


    public static final String QUERY_ALL_BOOK="queryAllBook";

    public static final String BOR_RENEWAL="borRenewal";

    public static final String SUPER="super";//超级管理员
    public static final String EXIT="exit";//退出
    public static final String REGIST="registAdmin";//注册


    public static final String QUERY_ALL_INFO="queryAllBookInfo";//书的列表
    public static final String USE_BOOK_NAME_LIST="bookName-msg";//书名查书
    public static final String VALIDATE_BOR_IdCARD = "validateBorIdCard";  //验证身份证是否存在

    public static final String GET_BOR_CANCEL_INFO = "getBorCancelInfo";   //获取用户注销信息

    public static final String RETURN_BOOK="returnBook";
    public static final String BOOK_LOSS="bookLoss";//书籍损毁查看
    public static final String VALUEDATE_ADMIN="value1111";//验证管理员和密码是否被注册
    public static final String CHULI="chulibook";//扣钱
    public static final String ADMIN_MAIN="adminMainMsg";//个人主页

    public static Action getAction(String uri) {
        Action action = null;

        switch (uri) {

            case RETURN_BOOK:
                action=new ReturnBookAction();
                break;
                case ADMIN_MAIN:
                action=new AdminMainAction();
                break;
                case CHULI:
                action=new ChuLiBookAction();
                break;
            case VALIDATE_BOR_IdCARD:
                action = new ValidateBorIdCardAction();
                break;
            case GET_BOR_CANCEL_INFO:
                action = new GetBorCancelInfoAction();
                break; case BOOK_LOSS:
                action = new BookLossAction();
                break;


            case ALL_BOR_INFO:
                action = new AllBorInfoAction();
                break;

            case QUERY_ALL_BOOK:
                action=new QueryAllBookAction();
                break;
            case BOR_RENEWAL:
                action=new BorRenewalAction();
                break;
            case GET_BOR_INFO:
                action = new GetBorInfoAction();
                break;
            case LOGIN_VERIFY:
                action = new LoginVerifyAction();
                break;
            case ADMIN_REGISTER:
                action = new AdminRegisterAction();
                break;
            case BOR_RECHARGE:
                System.out.println(BOR_RECHARGE);
                action = new BorRechargeAction();
                break;
            case ADD:
                action = new BookTypeAddAction();
                break;
            case LIST_BOOK:
                    action=new BookListAction();

                break;

            case BOOK_DEL:
                action=new BookLowerAction();
                break;
            case BOOK_ALTER:
                action= new BookAlterAction();
                break;
                case USER_MSG:
                action= new UserSendMsgAction();
                break;
                case BOOKS_ADD:

                action= new BookAddAction();
                break;
            case BOOKS_TOP:

                action= new BookTopAction();
                break;
                case SUPER:

                action= new SuperAdminAction();
                break;
            case EXIT:

                action= new AdminExitAction();
                break;
                case REGIST:
                action= new AdminRegisterAction();
                break;
                case VALUEDATE_ADMIN:
//                    ValueDateAdminAction
                    System.out.println(VALUEDATE_ADMIN);
                action= new ValueDateAdminAction();
                    break;
                    case QUERY_ALL_INFO:
                action= new QueryAllBookInfoAction();
                break; case USE_BOOK_NAME_LIST:
                action= new FindByBookName();
                break;case LEND_BOOK:
                action= new LendBookAction();
                break;

            case UPDATE_CANCEL:
                action = new UpdateCancelAction();
                break;
            case GET_BORROW_INFO:
                action = new GetBorrowInfoAction();
                break;



            default:
                throw new IllegalStateException("Unexpected value: " + uri);
        }
        return action;
    }

}
